import TarBarWithRoute from './components/TarBar'
import { useState } from 'react'
import { useRoutes, useLocation } from 'react-router-dom'
import routes from './router'
import './App.css'

function App() {
  const { pathname } = useLocation()
  const [pathList] = useState<Array<string>>(['/home', '/around', '/circle', '/mine'])
  const index = pathList.indexOf(pathname)

  const element = useRoutes(routes)
  return (
    <div className="App">
      <div className="container" style={{ paddingBottom: index === -1 ? '0px' : '' }}>
        {element}
      </div>
      {index > -1 && <TarBarWithRoute />}
    </div>
  )
}

export default App
